<template>
  <transition name="fade">
    <!-- 过度效果 -->
    <div class="header-detail" v-show="visible">
      <!-- 详情盒子 -->
      <div class="detail-wrapper clear-fix">
        <div class="detail-main">
          <!-- 商家名称 -->
          <h1 class="name">{{ seller.name }}</h1>
          <!-- 商家整体评分 -->
          <div class="star-wrapper">
            <!-- 星星组件 -->
            <star :size="48" :score="seller.score"></star>
          </div>
          <!-- 标题 -->
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>
          <!-- 优惠活动 -->
          <ul class="supports" v-if="seller.supports">
            <li
              class="support-item"
              v-for="(item, index) in seller.supports"
              :key="item.id"
            >
              <!-- 活动图标 -->
              <support-ico
                :size="2"
                :type="seller.supports[index].type"
                class="support-ico"
              ></support-ico>
              <!-- 活动具体文字介绍 -->
              <span class="text">{{ seller.supports[index].description }}</span>
            </li>
          </ul>
          <!-- 标题 -->
          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>
          <!-- 公告内容 -->
          <div class="bulletin">
            <p class="content">{{ seller.bulletin }}</p>
          </div>
        </div>
      </div>

      <!-- 关闭按钮 -->
      <div class="detail-close" @click="hide">
        <i class="icon-close"></i>
      </div>
    </div>
  </transition>
</template>

<script>
import SupportIco from "components/support-ico/support-ico";
import Star from "components/star/star";
import popupMixin from "common/mixins/popup";
export default {
  mixins: [popupMixin],
  name: "header-detail",
  props: {
    seller: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  components: {
    SupportIco,
    Star
  }
  // data() {
  //   return {
  //     visible: false
  //   };
  // },
  // methods: {
  //   show() {
  //     this.visible = true;
  //   },
  //   hide() {
  //     this.visible = false;
  //   }
  // }
};
</script>

<style lang="stylus" scoped>
@import "~common/stylus/mixin"
@import "~common/stylus/variable"

.header-detail
  position fixed
  z-index 100
  top 0
  left 0
  width 100%
  height 100%
  overflow auto
  // （如模糊或颜色偏移）
  backdrop-filter blur(10px)
  opacity 1
  color: $color-white
  background-color $color-bg-s
  // 过渡样式
  &.fade-enter-active,&.fade-leave-active
    transition all 0.5s
  &.fade-enter,&.fade-leave-active
    opacity 0
    background-color $color-bg
  // 详情容器
  .detail-wrapper
    display inline-block
    width 100%
    height 100%
    // 主要内容部分
    .detail-main
      margin-top 64px
      padding-bottom 64px
      .name
        line-height 16px
        text-align center
        font-size $fontsize-large
        font-weight 700
      // 评价星星
      .star-wrapper
        margin-top 18px
        padding 2px 0
        text-align center
      // 标题样式
      .title
        display flex
        width 80%
        margin 28px auto 26px auto
        align-items center
        // 线样式
        .line
          flex 1
          border-bottom 1px solid rgba(255,255,255,0.2)
        // 标题文字样式
        .text
          padding 0 12px
          font-weight bold
          font-size $fontsize-medium

      // 活动样式
      .supports
        width 80%
        margin 0 auto
        .support-item
          display flex
          align-items center
          padding 0 12px
          margin-bottom 12px
          // 最后一个元素去掉下边距
          &:last-child
            margin-bottom 0
          // 图标
          .support-ico
            margin-right 6px
          // 文字
          .text
            line-height 16px
            font-size $fontsize-small
      // 公告内容
      .bulletin
        width: 80%
        margin: 0 auto
        .content
          text-align justify
          padding: 0 12px
          line-height: 24px
          font-size: 12px
  // 关闭按钮
  .detail-close
    position: relative
    width: 32px
    height: 32px
    margin: -64px auto 0 auto
    clear: both
    font-size: 32px
</style>
